using System.Web.Compilation;
using System.Web.Mvc;
using System.Web.Routing;

namespace MvcApplication1.Controllers
{
    public class DefaultController : Controller
    {
        protected override void Execute(RequestContext requestContext)
        {
            var customer = new Customer
                               {
                                   Id = 2,
                                   Name = "Jeffrey Palermo",
                                   IsPreferred = true
                               };

            ViewData.Add("model", customer);
            string controllerName =
                requestContext.RouteData.GetRequiredString("controller");
            string pagePath = string.Format("~/Controllers/{0}.aspx", 
                controllerName);
            var page = (ViewDataPage) BuildManager
                  .CreateInstanceFromVirtualPath(
                  pagePath , typeof (ViewDataPage));
            page.ViewData = ViewData;
            page.ProcessRequest(System.Web.HttpContext.Current);
        }
    }
}